import React, { Component } from 'react'
import "./index.scss"
import { Layout, Table, Pagination } from "antd"
import { request } from '../../../api'
const { Header, Content, Footer } = Layout

const columns = [
    {
        title: '姓名',
        dataIndex: 'name',
        fixed: 'left',
        width: "50px",
    },
    {
        title: '学号',
        dataIndex: 'stu_id',
        sorter: true,
    },
    {
        title: '性别',
        dataIndex: 'sex',
    },
    {
        title: '专业',
        dataIndex: 'major',
    },
    {
        title: '单位',
        dataIndex: 'company',
    },
    {
        title: '城市',
        dataIndex: 'company_city',
    },
    {
        title: '联系人',
        dataIndex: 'contact_name',
    },
    {
        title: '联系方式',
        dataIndex: 'contact_phone',
    }

];
export default class UserList extends Component {
    state = {
        data: [],
        loading: false,
        Pagination: {

        }
    };
    componentDidMount() {
        request.getStudentsList()
            .then(res => {
                console.log(res);
                if (res.code == 200) {
                    this.setState({
                        loading: false,
                        data: res.result,
                    });
                }
            })
    }
    render() {
        const { data, loading } = this.state;
        return (
            <Layout style={{
                display: 'flex',
                flexDirection: 'column',
                height: "100%",
                backgroundColor: "#fff"
            }}>
                <Header>搜索栏</Header>
                <Content style={{}}>
                    <Table
                        showHeader={true}
                        columns={columns}
                        rowKey={item => item.stu_id}
                        dataSource={data}
                        loading={loading}
                        sticky={true}
                        scroll={{ x: 1500, y: 400, scrollToFirstRowOnChange: true }}


                    />
                </Content>
                {/* <Footer>
                    <Pagination defaultCurrent={6} total={500} />
                </Footer> */}
            </Layout>
        )
    }
}
